{% extends 'home/public/base.html' %}

{% block css %}
<link rel="stylesheet" type="text/css" href="/static/home/css/detail.css">
<link rel="stylesheet" type="text/css" href="/static/home/css/detail-app.css">
{% endblock %}


{% block con %}

<div class="page-detail app-detail" style="padding-top: 80px;">
    <div class="container">
        <!-- 产品购买 -->
        <div class="row">
            <div class="col-md-5 col-sm-12 col-xs-12">
                <div class="preview">
                    <!-- Tab panes -->
                    <div class="tab-content preview-booth pt10">
                        <div role="tabpanel" class="tab-pane active mod-pic" id="list-p1">
                            <img src="{{ ob.pic }}" width="375" height="375" class="sImg">
                        </div>

                    </div>

                </div>
            </div>
            <div class="col-md-7 col-sm-12 col-xs-12 pt10">
                <div class="property hidden-xs hidden-sm" id="property">
                    <div class="property-hd">
                        <h1>{{ ob.title }}</h1>
                    <div class="property-sell">
                        <dl class="property-sell-price clearfix">
                            <dt class="vm-metatit" id="J_discountTag">价
                                <span class="s-space"></span>
                                <span class="s-space"></span>格：</dt>
                            <dd>
                                <div class="mod-price">
                                    <small>¥</small>
                                    <span id="J_price" class="vm-money">{{ ob.price }}</span></div>
                                <div class="mod-original" id="J_originalPrice" style="display:none;"></div>
                                <div class="mod-activity"></div>
                                <div class="mod-countdown" id="J_discountCountDown" style="display:none;"></div>
                            </dd>
                        </dl>
                    </div>
                    <div class="property-sibling">
                        <dl data-property="型号" class="property-sibling-item">
                            <dt class="vm-metatit">型
                                <span class="s-space"></span>
                                <span class="s-space"></span>号：</dt>
                            <dd class="clearfix">
                                <a href="#" data-itemid="10478" class="prop" data-mtype="store_de_sib_1">魅蓝 Max</a>
                                <a href="javascript:;" data-itemid="10636" class="prop selected" data-mtype="store_de_sib_2">魅蓝 X</a></dd>
                        </dl>
                    </div>
                    <div class="property-set">
                        <dl class="property-set-sale" data-property="网络类型">
                            <dt class="vm-metatit">网络类型：</dt>
                            <dd class="clearfix">
                                <a data-value="14:18238" data-mtype="store_de_sp_1_1" href="#" title="全网通公开版" class="selected">
                                    <span>全网通公开版</span></a>
                            </dd>
                        </dl>
                        <dl class="property-set-sale" data-property="颜色分类">
                            <dt class="vm-metatit">颜色分类：</dt>
                            <dd class="clearfix">
                                <a data-value="3:22218" class="vm-sale-img selected" data-mtype="store_de_sp_2_1" href="#" title="流光金">
                                    <img src="/static/home/img/vm4.png" width="32" height="32">
                                    <span>流光金</span></a>
                                <a data-value="3:22219" class="vm-sale-img" data-mtype="store_de_sp_2_2" href="#" title="珠光白">
                                    <img src="/static/home/img/vm5.png" width="32" height="32">
                                    <span>珠光白</span></a>
                            </dd>
                        </dl>
                        <dl class="property-set-sale" data-property="内存容量">
                            <dt class="vm-metatit">内存容量：</dt>
                            <dd class="clearfix">
                                <a data-value="13:37" data-mtype="store_de_sp_3_1" href="#" title="32GB" class="selected">
                                    <span>32GB</span></a>
                            </dd>
                        </dl>
                    </div>
                    <div class="property-service">
                        <dl class="property-service-item clearfix">
                            <dt class="vm-metatit">支
                                <span class="s-space"></span>
                                <span class="s-space"></span>持：</dt>
                            <dd class="mod-bd" id="J_prodService">
                                <span>
                                    <i class="glyphicon glyphicon-ok-circle" aria-hidden="true"></i>花呗分期</span>
                                <span>
                                    <a href="#" target="_blank">
                                        <i class="glyphicon glyphicon-ok-circle" aria-hidden="true"></i>百城速达</a>
                                </span>
                                <span>
                                    <i class="glyphicon glyphicon-ok-circle" aria-hidden="true"></i>顺丰包邮</span>
                                <span>
                                    <i class="glyphicon glyphicon-ok-circle" aria-hidden="true"></i>7天无理由退货</span>
                            </dd>
                        </dl>
                        <dl class="property-service-suda clearfix" id="J_delivery">
                            <dt class="vm-metatit">配送
                                <span class="s-space"></span>至：</dt>
                            <dd class="mod-site clearfix">
                                <div id="site-selector" class="site-selector">
                                    <div class="text">广东 广州市 【请选择】</div></div>
                            </dd>
                        </dl>
                        <dl class="property-service-provider clearfix">
                            <dt class="vm-metatit">服
                                <span class="s-space"></span>
                                <span class="s-space"></span>务：</dt>
                            <dd class="clearfix">
                                <span id="J_installmentInfo"></span>本商品由 魅族 负责发货并提供售后服务</dd>
                        </dl>
                    </div>
                    <div class="property-huabei clearfix">
                        <div class="vm-metatit">花呗分期：</div>
                        <div class="clearfix property-huabei-bd" id="J_huabeiBody">
                            <a data-value="3" class="prop" data-mtype="store_de_hb_3">
                                <span class="vm-periods">¥499.67×3期</span>
                                <span class="vm-rate">免手续费</span></a>
                            <a data-value="6" class="prop" data-mtype="store_de_hb_6">
                                <span class="vm-periods">¥261.08×6期</span>
                                <span class="vm-rate">含手续费11.24/期</span></a>
                            <a data-value="12" class="prop" data-mtype="store_de_hb_12">
                                <span class="vm-periods">¥134.29×12期</span>
                                <span class="vm-rate">含手续费9.37/期</span></a>
                        </div>
                        <a href="//hd.meizu.com/rules/huabei.html" target="_blank" class="vm-desc">
                            <i class="iconfont-detail icon-question"></i>什么是花呗分期</a>
                    </div>
                    <div class="property-buy">
                        <p class="vm-message" id="J_message"></p>
                        <dl class="property-buy-quantity">
                            <dt class="vm-metatit">数
                                <span class="s-space"></span>
                                <span class="s-space"></span>量：</dt>
                            <dd class="clearfix">
                                <div class="mod-control">
                                    <a title="减少" href="javascript:;" class="vm-minus disabled">-</a>
                                    <input value="1" id="J_quantity" data-max="5" type="text">
                                    <a title="增加" href="javascript:;" class="vm-plus">+</a></div>
                            </dd>
                        </dl>
                        <div class="property-buy-action">
                            <!-- <a data-mtype="store_de_buy" href="javascript:void(0);" id="J_btnBuy" class="btn btn-danger btn-lg mr20">立即购买</a> -->
                            <a data-mtype="store_de_cart" href="javascript:void(0);" id="J_btnAddCart" class="btn btn-primary btn-lg" style="display:inline-block;">
                                <i></i>加入购物车
                            </a>
                            <span class="vm-service" id="J_panicBuyingWrap"></span>
                        </div>
                    </div>
                    <div class="prod-addition">
                        <input id="servertime" value="1503304001935" type="hidden">
                        <div class="layer-promo" id="layerPromo" style="display:none;">
                            <div class="layer-promo-hd">领取优惠券
                                <a class="vm-close" id="J_promoClose" href="#">╳</a></div>
                            <div class="layer-promo-bd">
                                <dl class="discount-coupon" id="J_discountCoupon">
                                    <dd class="discount-coupon-item clearfix multiple">
                                        <div class="mod-btn">
                                            <a class="vm-btn" data-key="658000850">立即领取</a></div>
                                        <div class="mod-bd clearfix">
                                            <p class="mod-bd-value">
                                                <span class="vm-amount">
                                                    <sup>¥</sup>10.00</span>
                                                <em>(多品券)</em></p>
                                            <p class="mod-bd-name">
                                                <span class="vm-name">818专享优惠券</span>
                                                <span class="vm-claim">满699可用</span></p>
                                            <p class="mod-bd-info">
                                                <span>2017.08.01 11:40 - 2017.08.22 00:00</span>
                                                <span class="vm-range ellipsis">适用范围：魅族-魅蓝E、魅族-魅蓝MAX、魅族-魅蓝5礼盒版、魅族-魅蓝 X、魅族-魅蓝 note5</span>
                                                <a class="vm-more" target="_blank" href="//lists.meizu.com/page/couponItems/850.html">查看适用&gt;</a></p>
                                        </div>
                                    </dd>
                                </dl>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        <!-- 产品购买 --></div>
    <!-- 漂浮的导航 -->
    <div class="detail-tab anim detail-fast-float" id="detailFast">
        <div class="fixed-container">
            <ul class="clearfix">
                <li class="">
                    <a href="javascript:void(0);">商品详情</a></li>
                <li class="">
                    <a href="javascript:void(0);">规格参数</a></li>
                <li class="current">
                    <a href="javascript:void(0);">常见问题</a></li>
            </ul>
            <div class="shortcut trans">
                <div class="shortcut-con trans">
                    <div class="mod-buy">
                        <a data-mtype="store_de_buynow" href="javascript:void(0);" id="J_btnBuyShortcut" class="btn btn-primary btn-lg">
                            <i>
                            </i>现在购买</a>
                    </div>
                    <div class="mod-total trans">魅蓝 X
                        <em class="vm-price" id="J_totalPriceShortcut">￥2998.00</em>
                        <p class="vm-title" id="J_summaryName">全网通公开版 珠光白 32GB</p></div>
                </div>
            </div>
            <div class="mod-title"></div>
        </div>
    </div>
    <!-- 漂浮的导航 E-->
    <!-- 产品详情 -->
    <div class="row detail" id="detail">
        <div class="detail" style="height:62px;">
            <div class="detail-tab" id="detailTabFixed">
                <div class="fixed-container">
                    <ul class="clearfix" style="display: block;">
                        <li class="current">
                            <a data-mtype="store_de_xq_1" href="javascript:void(0);">商品详情</a></li>
                        <li class="">
                            <a data-mtype="store_de_xq_2" href="javascript:void(0);">规格参数</a></li>
                        <li class="">
                            <a data-mtype="store_de_xq_3" href="javascript:void(0);">常见问题</a></li>
                    </ul>
                </div>
            </div>
        </div>
        {{ ob.info|safe }}
    </div>
    <!-- 产品详情 E--></div>

{% endblock %}

{% block js %}
<script type="text/javascript">
  //顶部导航鼠标经过出现内容
  topNav();
  //登录图片鼠标经过
  topLogin();
  //nav标签
  detaNav();
  //回顶部
  backTop();
  //移动端置顶
  appTopNav();
  //数量增加减少
  addMin();


//获取加入购物车的按钮，绑定单击事件
$('#J_btnAddCart').click(function(){
    //获取选择了的商品和数量
    var gid = {{ ob.id }}
    var num = Number($('#J_quantity').val())

    //发送ajax请求，把商品的id号和购买的数量 传递到后台使用
    $.get('{% url "myhome_cartadd" %}',{'gid':gid,'num':num},
        function(data){
        if(data.error == 0){
            res = confirm('成功加入到购物车，是否进入购物车列表页')
            if(res){
                location.href="{% url 'myhome_cartindex' %}"
            }
        }else{
            alert(data['msg'])
        }
        })
})






</script>

{% endblock %}